package com.example.demo.mapper;

import com.example.demo.model.Administrator;
import com.example.demo.model.Leave;
import com.example.demo.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

public interface loingMapper {
    //前台注册
    @Insert("insert into user(uname,e_mail,password) values (#{uname},#{e_mail},#{password})")
    int add(User user);
    //前台登录查询账号密码
    @Select("select uname,password from user where uname=#{uname} and password=#{password}")
    User seleUp(String uname,String password);

    //后台登录查询账号密码
    @Select("select user,password from Administrator where user=#{user} and password=#{password}")
    Administrator seleAd(String user,String password);

    //前台留言
    @Insert("insert into Leave(name,e_mail,sub,message) values (#{name},#{e_mail},#{sub},#{message})")
    int addLeave(Leave leave);
}
